import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    meta: {
      title: '登陆'
    },
    component: () =>
      import(/* webpackChunkName: "login" */ '../views/LoginView.vue')
  },
  {
    path: '/basic',
    name: 'BasicLayout',
    component: () =>
      import(/* webpackChunkName: "about" */ '../layouts/index.vue'),
    redirect: '/basic/home',
    children: [
      {
        path: 'home',
        name: 'Home',
        meta: {
          title: '首页'
        },
        component: import(
          /* webpackChunkName: "home" */ '../views/HomeView.vue'
        )
      },
      {
        path: 'about',
        name: 'About',
        meta: {
          title: '关于'
        },
        component: import(
          /* webpackChunkName: "about" */ '../views/AboutView.vue'
        )
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
